<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><#if pageTitle??>${pageTitle}</#if>出租屋管理系统-人员管理</title>
<#assign current="pers">
<#include "../common/page_head.ftl">
<script type="text/javascript">
function edit(id){
	$.jBox("iframe:/per/persEdit?id="+id, {
	    title: "修改人员信息",
	    width: 700,
	    height: 320,
	    buttons: {}
	});
}

function delUser(id,msg){

	$.jBox.confirm("确定删除 ["+msg+"] 人员吗？", "确认操作", function (v, h, f) {
	    if (v == 'ok'){
	    	
	    	$.post("<s:url value='/dev/delDevice'/>",{id:id},function(responseText){
	    		if(responseText==true){
	    			$.jBox.info("操作成功，请刷新查看结果", "成功信息",{top: '20%'});
	    			//window.location.reload();
	    		}else{
	    			$.jBox.error("操作失败", "失败信息");
	    		}
	    	});

	    	
		}
	    return true; 
	},{top: '40%'});
	
}

function delUsers(){
	//批量删除人员
	var selectedItems = new Array();
	$("input[type=checkbox][name=cbitem]:checked").each(function() {selectedItems.push($(this).val());});
	
	if (selectedItems .length == 0){
		$.jBox.tip("没有选择批量删除的数据.", "warning",{top: '40%'});
	    return;
	}
	
	$.jBox.confirm("确定批量删除吗？", "批量操作确认", function (v, h, f) {
	    if (v == 'ok'){

	    	$.post("/dev/delDevices",{userIds:selectedItems.join(',')},function(data){
	    		if(data>0){
	    			$.jBox.tip("批量删除 "+data+" 条，请刷新查看结果", "success",{top: '40%'});
	    			
	    		}else{
	    			$.jBox.error("批量删除失败", "失败信息");
	    		}
	    		
	    	});
	    	
		}
	    return true; 
	},{top: '40%'});
	
}

$().ready(function(){
	pilicat.alternately('list');

});

</script>


</head>
<body>

    <div style="height: 60px; overflow: hidden">
		<#include "../common/u_top.ftl">
    </div>
    
    <div id="frame_side">
    <#include "../common/u_login_info.ftl">
    <#include "../common/u_left_menu.ftl">
    </div>
    
    <div id="body_box">
    <table cellpadding="0" cellspacing="0" border="0" class="icon">
        <tr>
            <td>
            </td>
        </tr>
    </table>
    
    <table cellpadding="0" cellspacing="0" border="0" class="table">
		<tbody>
			<tr>
				<td valign="top" align="right">
					<form action="" method="get" name="search" id="search">
					<table cellpadding="0" cellspacing="6" border="0">
						<tbody>
						<tr>							
							<td></td>
						</tr>
					</tbody></table>			
					</form>
				</td>
			</tr>
		</tbody>
	</table>
	
	<div class="rounded table">
    <form action="" method="get" name="search_form" id="search_form">
        <table width="100%" cellpadding="0" cellspacing="0" border="0" class="box_top">
            <tr>
                <td class="title">人员列表</td>
                <td><div>
                	<span>人员卡号：</span><input type="text" name="deviceSn" />
                	<span>人员姓名：</span><input type="text" name="deviceName" />
                	<a class="" href="javascript:;" onclick="add();">搜索</a>
                	</div>
                </td>
            </tr>
        </table>
    </form>
    <table class="list td_align" cellpadding="0" cellspacing="1" border="0">
    <tr>
        <td class="field_head" width="30">选择</td>
        <td class="field_head">姓名</td>
        <td class="field_head">工号</td>
        <td class="field_head">来源设备</td>
        <td class="field_head">创建时间</td>
        <td class="field_head">最后更新时间</td>
        <td class="field_head">操作</td>
    </tr>
	<#if pageData??>
		<#if pageData.pageData??>
			<#list pageData.pageData as persEntity>
			<tr class="<#if (persEntity.id%2==0)>odd<#else>even</#if>">
				<td>
					<input type="checkbox" name="cbitem" value="${persEntity.id?c}"/>
				</td>
				<td><#if persEntity.personName??>${persEntity.personName}</#if></td>
				<td>${persEntity.personPin}</td>
				<td><#if persEntity.personOldSn??>${persEntity.personOldSn}</#if></td>
				<td><#if persEntity.createTime??>${persEntity.createTime?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
				<td><#if persEntity.lastUpdate??>${persEntity.lastUpdate?string("yyyy-MM-dd HH:mm:ss")}</#if></td>

				<td class="operation">
					<a href="javascript:;" onclick="edit(${persEntity.id?c});">
					 	<img src="/css/images/operation/pencil.png" title="修改"/>
					 </a>
					 <a href="javascript:;" onclick="delUser(persEntity.id?c},'<#if persEntity.personName??>${persEntity.personName}</#if>');">
					 	<img src="/css/images/operation/trashcan_delete.png" title="删除"/>
					 </a>
				</td>
			
			</tr>
		    </#list>
	    
	    </#if>
	<#else>
	    <tr>
	        <td colspan="7" class="field_head">没有相关数据</td>
	    </tr>
	</#if>
	 </table>
     <table class="table top_line">
         <tr>
             <td>
                 <table cellpadding="0" cellspacing="0" border="0">
                     <tr>
                         <td class="all_action">
                             <input name="allChkbox" id="allChkbox" type="checkbox" onclick="pilicat.select_all(this.form);" />
                         </td>
                         <td>&nbsp;全选/取消 &nbsp;</td>
                         <td class="operation">
                             
                         </td>
                         
                     </tr>
                 </table>
             </td>
         </tr>
     </table>
     
	
    </div>
	<#include "../common/u_bottom.ftl">
    </div>
</body>
</html>